$(document).ready(function(){
	/*查询*/
	$("body #nav_select").each(function(i){ 
	i= i+1
	this.id = "nav_select" + i; 
	var SumimasenSelect = $("#nav_select"+i)
	$(SumimasenSelect).find("ul li:first").hover(function(){
		$(".s").css("background","url(images/68_60.PNG) 6px 0px no-repeat");
		$(this).parent("ul").css("height",100)
		$(this).siblings("ul li:not(.s)").mouseenter(function(){
			$(".s").css("background","url(images/68_60.PNG) 6px 0px no-repeat");
			$(this).css("background","#ff6600").css("color","#FFFFFF")
		});
		$(this).siblings("ul li:not(.s)").mouseleave(function(){
			$(this).css("background","none").css("color","#585858")
			$(".s").css("background","url(images/68_60.PNG) 6px -30px no-repeat");
		});
		$(this).siblings("ul li:not(.s)").click(function(){
			$(this).parent("ul").css("height",28)
			var cdContent = $(this).text()
			$(SumimasenSelect).find("ul li:first").text(cdContent)
		});
		$(this).parent(SumimasenSelect).mouseleave(function(){
			$(this).css("height",28)
		});
			
	});
		
		},function(){
		$(".s").css("background","url(images/68_60.PNG) 6px -30px no-repeat");
		
	});
	
	
	
	/*筛选条件*/
	$("#select1 dd").click(function () {
		$(this).addClass("selected").siblings().removeClass("selected");
		if ($(this).hasClass("select-all")) {
			$("#selectA").remove();
		} else {
			var copyThisA = $(this).clone();
			if ($("#selectA").length > 0) {
				$("#selectA a").html($(this).text());
			} else {
				$(".select-result dl").append(copyThisA.attr("id", "selectA"));
			}
		}
	});
	
	$("#select2 dd").click(function () {
		$(this).addClass("selected").siblings().removeClass("selected");
		if ($(this).hasClass("select-all")) {
			$("#selectB").remove();
		} else {
			var copyThisB = $(this).clone();
			if ($("#selectB").length > 0) {
				$("#selectB a").html($(this).text());
			} else {
				$(".select-result dl").append(copyThisB.attr("id", "selectB"));
			}
		}
	});
	
	$("#select3 dd").click(function () {
		$(this).addClass("selected").siblings().removeClass("selected");
		if ($(this).hasClass("select-all")) {
			$("#selectC").remove();
		} else {
			var copyThisC = $(this).clone();
			if ($("#selectC").length > 0) {
				$("#selectC a").html($(this).text());
			} else {
				$(".select-result dl").append(copyThisC.attr("id", "selectC"));
			}
		}
	});
	
	$("#selectA").live("click", function () {
		$(this).remove();
		$("#select1 .select-all").addClass("selected").siblings().removeClass("selected");
	});
	
	$("#selectB").live("click", function () {
		$(this).remove();
		$("#select2 .select-all").addClass("selected").siblings().removeClass("selected");
	});
	
	$("#selectC").live("click", function () {
		$(this).remove();
		$("#select3 .select-all").addClass("selected").siblings().removeClass("selected");
	});
	
	$(".select dd").live("click", function () {
		if ($(".select-result dd").length > 1) {
			$(".select-no").hide();
		} else {
			$(".select-no").show();
		}
	});
	
	/*项目标签*/
	
	function resettb_tabs(){
        $("#tb_content > div").hide(); //Hide all tb_content
        $("#tb_tabs a").attr("id",""); //Reset id's      
    }

    var myUrl = window.location.href; //get URL
    var myUrlTab = myUrl.substring(myUrl.indexOf("#")); // For localhost/tb_tabs.html#tab2, myUrlTab = #tab2     
    var myUrlTabName = myUrlTab.substring(0,4); // For the above example, myUrlTabName = #tab

    (function(){
        $("#tb_content > div").hide(); // Initially hide all tb_content
        $("#tb_tabs li:first a").attr("id","tb_current"); // Activate first tab
        $("#tb_content > div:first").fadeIn(); // Show first tab tb_content
        
        $("#tb_tabs a").on("click",function(e) {
            e.preventDefault();
            if ($(this).attr("id") == "tb_current"){ //detection for tb_current tab
             return       
            }
            else{             
            resettb_tabs();
            $(this).attr("id","tb_current"); // Activate this
            $($(this).attr('name')).fadeIn(); // Show tb_content for tb_current tab
            }
        });

        for (i = 1; i <= $("#tb_tabs li").length; i++) {
          if (myUrlTab == myUrlTabName + i) {
              resettb_tabs();
              $("a[name='"+myUrlTab+"']").attr("id","tb_current"); // Activate url tab
              $(myUrlTab).fadeIn(); // Show url tab tb_content        
          }
        }
    })()
	
	
	
});


